<?php
namespace app\admin\controller;
use app\admin\validate\UserValidate;
use think\Validate;

/**
 * 纠纷控制器
 * Class Advert
 * @package app\admin\controller
 */
class Dispute extends UserValidate{
    public function index(){
        return view();
    }

    public function indexAdd(){
//        $file = request()->file('model');
        $data = [
            'name'  => 'thinkphp',
            'age' => 'thinkphp',
        ];
        $validate = new \app\admin\validate\DisputeModel;
        if (!$validate->check($data)) {
            dump($validate->getError());
        }
//        $target = $file->rule('md5')->validate(['size'=>314572800000000,'ext'=>'jpg', 'gif', 'png', 'jpeg','txt','doc','word','excel','pdf','ppt','xls','mp4'])->move( '../public/image',time());
//        var_dump($target);
    }




    function UpFile($filepath = null){
        $upload = new \Think\Upload();// 实例化上传类
        $upload->maxSize   =     314572800000000  ;// 设置附件上传大小【这个要足够大】
        $upload->exts      =     array('jpg', 'gif', 'png', 'jpeg','txt','doc','word','excel','pdf','ppt','xls','mp4');// 设置附件上传类型
        $upload->rootPath  =     './Public/'; // 设置附件上传根目录
        $upload->savePath  =     $filepath ? $filepath : 'upload/'; // 设置附件上传（子）目录
        $upload->autoSub = true;
        $upload->subName = array('date','Ymd');
        $upload->saveName = myrule();
        //$upload->saveName = time().'_'.mt_rand();  //文件名规则
        // 上传文件
        $info   =   $upload->upload();
        if(!$info) {// 上传错误提示错误信息
            return $upload->getError();
        }else{// 上传成功 获取上传文件信息
            return $info;
        }
    }
}